home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 5 / Example 5.7 / mouse.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-29  |  960 b   |  52 lines

  1. #ifndef _MOUSE
  2. #define _MOUSE
  3.  
  4. #include <d3dx9.h>
  5. #include <dinput.h>
  6. #include "debug.h"
  7. #include "intpoint.h"
  8. #include "mesh.h"
  9.  
  10. struct RAY{
  11.     RAY();
  12.     RAY(D3DXVECTOR3 o, D3DXVECTOR3 d);
  13.  
  14.     //Our different intersection tests
  15.     float Intersect(MESHINSTANCE iMesh);
  16.     float Intersect(BBOX bBox);
  17.     float Intersect(BSPHERE bSphere);
  18.  
  19.     D3DXVECTOR3 org, dir;
  20. };
  21.  
  22.  
  23. class MOUSE : public INTPOINT{
  24.     friend class CAMERA;
  25.     public:
  26.         MOUSE();
  27.         ~MOUSE();
  28.         void InitMouse(IDirect3DDevice9* Dev, HWND wnd);
  29.         bool ClickLeft();
  30.         bool ClickRight();
  31.         bool WheelUp();
  32.         bool WheelDown();
  33.         bool Over(RECT dest);
  34.         bool PressInRect(RECT dest);
  35.         void Update();
  36.         void Paint();
  37.         RAY GetRay();
  38.  
  39.         float m_speed;
  40.         int m_type;
  41.  
  42.     private:
  43.         IDirect3DDevice9* m_pDevice;
  44.         LPDIRECTINPUTDEVICE8 m_pMouseDevice;
  45.         DIMOUSESTATE m_mouseState;
  46.         IDirect3DTexture9* m_pMouseTexture;
  47.         LPD3DXSPRITE m_pSprite;
  48.         RECT m_viewport;
  49. };
  50.  
  51.  
  52. #endif